package com.bank.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.bank.exception.CommonException;
import com.bank.service.DemandAccountService;
import com.bank.service.TimeAccountService;

/*账户信息主控制类*/
@Controller
public class AccountController  extends BaseController{

	Logger logger = Logger.getLogger(AccountController.class);
	
	@Autowired
	DemandAccountService demandAccountService;    // 对公
	
	@Autowired
	TimeAccountService  timeAccountService;       // 对私
	
	@RequestMapping(value="doOpenAccount.do",method = RequestMethod.POST)
	public @ResponseBody Map<String, Object> doOpenAccount(@RequestBody Map<String,Object> params,HttpServletRequest request) throws CommonException{
		logger.debug("开户处理");
		String acct_type = (String)params.get("acct_type");
		if(acct_type.equals("01")){
			demandAccountService.openAccount(params);
		}else{
			timeAccountService.openAccount(params);
		}
		return this.setAndGetSuccess();
	}
	
}
